Introduction

Image Kit - Manipulate images

Image Kit is designed to allow you to manipulate images in real-time. This includes basic editing of images (resizing, pasting, copying, edit channels, ...) as well as applying effects to them (brightness, emboss, sharpen, blur, ...).

Important terminology

Image Kit separates two types of images: normal images and render targets.

Normal images are probably the images you have been using all this time in DarkBasic Pro. Unfortunately, if you want to apply an effect to any of these images, you would normally have to convert it to a memblock and edit the data there before converting them back to an image. This is in most cases time-consuming. Image Kit implements commands that skip the step of converting an image to a memblock, allowing it to be much faster. Although the CPU (the processor) has access to any pixel it wants, the GPU (the graphics card) can't write to a normal image. This means that, even though a normal image is the most versatile of the two image types, it is also the slowest.

Render targets are used by the GPU. This means that the CPU doesn't have access to any of the data of a render target. The GPU has a very large advantage over the CPU, in that it can calculate multiple pixels at the same time, while the CPU can't. DarkBasic Pro usually doesn't use this type of image, unless for one situation: Render To Image. If you have tried to convert such an image to a memblock then you will see that it will result in an error. This is exactly because the CPU can't access the data that is handled by the GPU.

Effect files

Using render targets is usually incredibly fast, but applying an effect to them is pretty hard, if not impossible in some cases. Well, that's if you don't count in effect files. Image Kit allows you to load effect files, mainly for pixel shaders, and use them on your render targets. This allows you to do a lot of things. If you want to learn a bit more about shaders (in effect files), check out the DarkBasic Pro forum for examples.
Image Kit deals a little different with effect files than DarkBasic Pro does though. Image Kit does not support the extra semantics that DarkBasic Pro does (like string ResourceName = "filename.bmp";). Aside from this, nothing stops you from writing your own custom made effect files.

Compatible commands

Some commands are not compatible with normal images and some aren't with render targets. Please check the index, or the help files to see which commands are compatible and which ones are not.


Index